// 获取元素
var modal = document.getElementById("myModal");

// 获取按钮元素
var btn = document.getElementById("icon-btn1");

// 获取关闭弹窗的<span>元素
var span = document.getElementsByClassName("close")[0];

//打开弹窗
btn.onclick = function () {
    modal.style.display = "block";
}

//关闭弹窗
span.onclick = function () {
    modal.style.display = "none";
}

// 点击弹窗外的区域，关闭弹窗
window.onclick = function (event) {
    if (event.target == modal) {
        modal.style.display = "none";
    }
}